package com.totoro.mapper;

import com.totoro.pojo.MyHistory;
import com.totoro.pojo.User;
import com.totoro.pojo.UserOnline;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author TOTORO
 * @date 2021/5/29 15:49
 */
@Repository
public interface UserMapper {
    List<User> findAllUser();

    User findUserById(@Param("uid") int uid);

    List<User> userNameTest(@Param("name") String name);

    int addUser(User user);

    int updateUser(User user);

    List<User> userInfoToPhone(@Param("phone") String phone);

    User checkUser(@Param("val") String value);

    int updatePassword(@Param("value") String value, @Param("password") String password, @Param("salt") String salt);

    User findUser(@Param("uid") int uid);

    Integer saveUserDataByUid(User user);

    List<MyHistory> findUserHistory(@Param("uid") int uid);

    @Insert("insert into my_history(uid,pid) values(#{uid},#{pid})")
    Integer addMyHistory(MyHistory myHistory);

    MyHistory repeatHistory(@Param("uid") int uid,@Param("pid") int pid);

    Integer deleteHistory(@Param("mhId") int mhid);

    Integer addUserOnlineCount(@Param("uid") int uid);

    UserOnline findDayUserOnline(UserOnline userOnline);

    Integer addUserScore(@Param("uid") int uid, @Param("score") int score);

    Integer deleteUser(@Param("uid") int uid);

    Integer untieUserBan(@Param("uid") int uid);

}
